#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
    int N = 0;
    scanf("%d ", &N);
    int arr[N][N];
    int i = 0;

    for (i = 0; i < N; i++)
    {
        int j = 0;
        for (j = 0; j < N; j++)
        {
            scanf("%d ", &arr[i][j]);
        }
    }
    for (i = 1; i < N; i++)
    {
        int j = 0;
        for (j = 0; j < i; j++)
        {
            if (arr[i][j] != 0)
            {
                printf("NO\n");
                return 0;
            }
        }
    }
    printf("YES\n");
    return 0;
}